#version 300 es
precision mediump float;
uniform float uR;

in vec2 mcLongLat;
in vec3 vPosition;
in vec4 vColor;
in vec4 vAmbient;
in vec4 vDiffuse;
in vec4 vSpecular;

out vec4 fragColor ;

vec3 getColor1(){
    vec3 color;
    float n = 8.0;
    float span = 2.0*uR/n;

    int i = int((vPosition.x + uR)/span);
    int j = int((vPosition.y + uR)/span);
    int k = int((vPosition.z + uR)/span);

    int whichColor = int(mod(float(i+j+k),2.0));

    if(whichColor == 1) {
    color = vec3(0.678,0.231,0.129);
    }else{
     color = vec3(1.0,1.0,1.0);
    }
    return color ;
}

vec4 getColor2(){
    return vColor ;
}

void main(){

  fragColor=vSpecular *vec4( getColor1(),0);
    //fragColor=getColor2() ;
}